package com.sa07.ui.components;

import java.awt.Color;

import javax.swing.BorderFactory;
import javax.swing.JLabel;

import com.sa07.ui.enums.TestResult;

/**
 * 测试结果控件
 * 
 * @author Long.shangbo
 *
 * 2014-2-16 下午11:29:42
 */
public class JtestResultContol extends JLabel {

	private static final long serialVersionUID = -234205410077648160L;
	
	public static final int defaultWidth = 250;
	
	public static final int defaultHeight = 25;
	
	public JtestResultContol(){
		super("等待测试结果...");
		setBorder(BorderFactory.createEtchedBorder());
		setOpaque(true);
		setBackground(new Color(252, 223, 132));
	}
	
	/**
	 * 设置测试结果
	 * @param testResult
	 */
	public void setTestResult(TestResult testResult){
		switch (testResult) {
			case SUCCESS:
				setBackground(Color.green);
				setForeground(Color.BLACK);
				break;
			default:
				setBackground(Color.RED);
				setForeground(Color.WHITE);
				break;
		}
	}
}
